package org.zn.plus.mybatis.sql.builder;

import java.util.Map;

import org.zn.plus.mybatis.sql.builder.data.adapter.DataModelAdapter;
import org.zn.plus.mybatis.sql.builder.model.Fragment;

public class QueryBuilderFactory extends QueryFragmentFactory<Map<String, Object>> implements BuilderFactory,FragmentFactory<Map<String, Object>,Fragment>{

	@Override
	public QueryBuilder getBuilder(Map<String, Object> data, String adapterName) {
	
		QueryBuilder qb=new QueryBuilder();
		
		Fragment fment= getFragment(data, adapterName);
		
		qb.addFragment(fment);
		
		return qb;
	}

	@Override
	public Fragment getFragment(Map<String, Object> data, DataModelAdapter<Map<String, Object>, Fragment> adapter) {
		// TODO Auto-generated method stub
		
		return adapter.dataAdaptee(data);
	}

	@Override
	public Fragment getFragment(Map<String, Object> data, String adapterName) {
		
		DataModelAdapter<Map<String, Object>, Fragment> adapter=  getModelAdapter(adapterName);

		return adapter.dataAdaptee(data);
	}

}
